<?php

/**
 * Researchoverlay form base class.
 *
 * @method Researchoverlay getObject() Returns the current form's model object
 *
 * @package    Redsea20
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseResearchoverlayForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'           => new sfWidgetFormInputHidden(),
      'researchid'   => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Research'), 'add_empty' => false)),
      'overlaytitle' => new sfWidgetFormInputText(),
      'overlaytype'  => new sfWidgetFormInputText(),
      'slat'         => new sfWidgetFormInputText(),
      'wlng'         => new sfWidgetFormInputText(),
      'nlat'         => new sfWidgetFormInputText(),
      'elng'         => new sfWidgetFormInputText(),
      'overlayimage' => new sfWidgetFormTextarea(),
      'created_at'   => new sfWidgetFormDateTime(),
      'updated_at'   => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'           => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'researchid'   => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Research'))),
      'overlaytitle' => new sfValidatorString(array('max_length' => 100)),
      'overlaytype'  => new sfValidatorString(array('max_length' => 50)),
      'slat'         => new sfValidatorString(array('max_length' => 50)),
      'wlng'         => new sfValidatorString(array('max_length' => 50)),
      'nlat'         => new sfValidatorString(array('max_length' => 50)),
      'elng'         => new sfValidatorString(array('max_length' => 50)),
      'overlayimage' => new sfValidatorString(array('required' => false)),
      'created_at'   => new sfValidatorDateTime(),
      'updated_at'   => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('researchoverlay[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Researchoverlay';
  }

}
